def 翻译(变量名):
    d = {"0": "Ze", "1": "On", "2": "Tw", "3": "Th", "4": "Fo",
         "5": "Fi", "6": "Si", "7": "Se", "8": "Ei", "9": "Ni"}
    字母表 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    res = ""
    for i in range(len(变量名)):
        if 变量名[i] in 字母表:
            res += 变量名[i]
        elif 变量名[i] in d:
            res += d[变量名[i]]
        else:
            pass
    return res


def 清空变量(文件名):
    open(文件名, "w").close()


def 定义变量(文件名, 变量名, 变量值):
    assert("_" not in 变量名)
    变量名 = 翻译(变量名)
    s = "\\newcommand{\\%s}{%s}\n" % (变量名, 变量值)
    with open(文件名, "a") as f:
        f.write(s)
